this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(e,t,s,i,a,r,n,o,l,c){"use strict";const h=/^rgba? ?\((\d{1,3})[, ]+(\d{1,3})[, ]+(\d{1,3})([, ]+([\d\.]{1,5}))?\)$/i;function u(e){return!!e.match(h)}const g=/^#([\da-f]{3}){1,2}$/i;function d(e){return!!e.trim().match(g)}const p=/^hsla?\((\d{1,3}), ?(\d{1,3})%, ?(\d{1,3})%(, ?([\d .]+))?\)/i;function m(e){return!!e.trim().match(p)}function v(e){if(e.length===4){const t=parseInt(`0x${e[1]}${e[1]}`,16);const s=parseInt(`0x${e[2]}${e[2]}`,16);const i=parseInt(`0x${e[3]}${e[3]}`,16);return{r:t,g:s,b:i}}if(e.length===7){const t=parseInt(`0x${e[1]}${e[2]}`,16);const s=parseInt(`0x${e[3]}${e[4]}`,16);const i=parseInt(`0x${e[5]}${e[6]}`,16);return{r:t,g:s,b:i}}return{r:255,g:255,b:255}}function f(e){const t=e.r/255;const s=e.g/255;const i=e.b/255;const a=Math.max(t,s,i);const r=Math.min(t,s,i);let n,o,l=(a+r)/2;if(a===r){n=o=0}else{const e=a-r;o=l>.5?e/(2-a-r):e/(a+r);switch(a){case t:n=(s-i)/e+(s<i?6:0);break;case s:n=(i-t)/e+2;break;case i:n=(t-s)/e+4;break}n*=.6}return{h:Math.round(n*100),s:Math.round(o*100),l:Math.round(l*100),a:"a"in e?e.a:1}}function b(e){const t=v(e.trim());return f(t)}function y(e){let t=e.r.toString(16);let s=e.g.toString(16);let i=e.b.toString(16);if(t.length===1){t="0"+t}if(s.length===1){s="0"+s}if(i.length===1){i="0"+i}return"#"+t+s+i}function C(e){const t=e.h;const s=e.s/100;const i=e.l/100;let a=(1-Math.abs(2*i-1))*s;let r=a*(1-Math.abs(t/60%2-1));let n=i-a/2;let o=0;let l=0;let c=0;if(0<=t&&t<60){o=a;l=r;c=0}else if(60<=t&&t<120){o=r;l=a;c=0}else if(120<=t&&t<180){o=0;l=a;c=r}else if(180<=t&&t<240){o=0;l=r;c=a}else if(240<=t&&t<300){o=r;l=0;c=a}else if(300<=t&&t<360){o=a;l=0;c=r}o=Math.round((o+n)*255);l=Math.round((l+n)*255);c=Math.round((c+n)*255);return{r:o,g:l,b:c}}function A(e){const t=C(e);return y(t)}function L(e){let t=e.trim().match(h);if(t.length>0){return f({r:c.Text.toNumber(t[1]),g:c.Text.toNumber(t[2]),b:c.Text.toNumber(t[3]),a:t[5]?c.Text.toNumber(t[5]):1})}}function T(e){let t=e.trim().match(p);if(t&&t.length>0){return{h:c.Text.toNumber(t[1]),s:c.Text.toNumber(t[2]),l:c.Text.toNumber(t[3]),a:t[5]?c.Text.toNumber(t[5]):1}}}const E=/^(var\()?((--[\w\d-]*?)(-opacity_([\d_]+)?)?)\)?$/i;function I(e){return!!e.trim().match(E)}function V(e){const t=e.trim().match(E);if(!!t){const e={full:t[2],name:t[3]};if(t[3]){const s="--primary-opacity-0_";const i="--primary-opacity-0";if(t[3].startsWith(i)&&!t[3].startsWith(s)){e.opacity=0}if(t[3].startsWith(s)){let i=t[3].substr(s.length);if(i.length===1&&i!==0){i=i/10}if(i.length===2){i=i/100}e.opacity=i}}if(t[5]){e.opacity=+parseFloat(t[5].replace("_",".")).toFixed(1)}return e}return null}const _={h:205,s:1,l:50,a:1};const S="cover";const P="scroll";const N=null;const w={url:null,size:S,attachment:P,overlay:N};class R{constructor(e){this.value=_;this.hex=null;this.cssVar=null;this.setValue(e)}getName(){if(this.hex){return this.getHex()+"_"+this.getOpacity()}const{h:e,s:t,l:s}=this.getHsl();return`${e}-${t}-${s}-${this.getOpacity()}`}setValue(e){if(c.Type.isObject(e)){if(e instanceof R){this.value=e.getHsla();this.cssVar=e.getCssVar();this.hex=e.getHexOriginal()}else{this.value={...this.value,...e}}}if(c.Type.isString(e)){if(m(e)){this.value=T(e)}else if(d(e)){this.value={...b(e),a:_.a};this.hex=e}else if(u(e)){this.value=L(e)}else if(I(e)){const t=V(e);const s="--primary";if(t!==null){this.cssVar=t.name;if("opacity"in t){this.cssVar=s;this.setValue(c.Dom.style(document.documentElement,this.cssVar));this.setOpacity(t.opacity)}else{this.setValue(c.Dom.style(document.documentElement,this.cssVar))}}}}this.value.h=Math.round(this.value.h);this.value.s=Math.round(this.value.s);this.value.l=Math.round(this.value.l);this.value.a=this.value.a.toFixed(2);const t=Math.round(this.value.a*100%5);if(t<3){this.value.a=(this.value.a*100-t)/100}else{this.value.a=(this.value.a*100-t+5)/100}return this}setOpacity(e){this.setValue({a:e});return this}lighten(e){this.value.l=Math.min(this.value.l+e,100);this.hex=null;return this}darken(e){this.value.l=Math.max(this.value.l-e,0);this.hex=null;return this}saturate(e){this.value.s=Math.min(this.value.s+e,100);this.hex=null;return this}desaturate(e){this.value.s=Math.max(this.value.s-e,0);this.hex=null;return this}adjustHue(e){this.value.h=(this.value.h+e)%360;return this}getHsl(){return{h:this.value.h,s:this.value.s,l:this.value.l}}getHsla(){return{h:this.value.h,s:this.value.s,l:this.value.l,a:this.value.a}}getHex(){return this.hex||A(this.value)}getHexOriginal(){return this.hex}getOpacity(){var e;return(e=this.value.a)!=null?e:_.a}getCssVar(){return this.cssVar}getStyleString(){if(this.cssVar===null){if(this.hex&&this.getOpacity()===_.a){return this.hex}const{h:e,s:t,l:s,a:i}=this.value;return`hsla(${e}, ${t}%, ${s}%, ${i})`}else{let e=this.cssVar;if(this.value.a!==_.a){e=e+"-opacity-"+String(this.value.a).replace(".","_")}return`var(${e})`}}getStyleStringForOpacity(){const{h:e,s:t,l:s}=this.value;return`linear-gradient(to right, hsla(${e}, ${t}%, ${s}%, 0) 0%, hsla(${e}, ${t}%, ${s}%, 1) 100%)`}static compare(e,t){return e.getHsla().h===t.getHsla().h&&e.getHsla().s===t.getHsla().s&&e.getHsla().l===t.getHsla().l&&e.getHsla().a===t.getHsla().a&&e.cssVar===t.cssVar}static getMedian(e,t){return new R({h:(e.getHsla().h+t.getHsla().h)/2,s:(e.getHsla().s+t.getHsla().s)/2,l:(e.getHsla().l+t.getHsla().l)/2,a:(e.getHsla().a+t.getHsla().a)/2})}getContrast(){let e=60;let t=this.getHsl().h*Math.PI/180;e+=Math.sin(t)*10+5;let s=e-45*this.getHsl().l/100;return new R(this.value).setValue({l:(this.getHsl().l+s)%100})}getLighten(){let{h:e,s:t,l:s}=this.getHsl();if(t>0){t+=(s-50)/100*60;t=Math.min(100,Math.max(0,s))}s+=10+20*s/100;s=Math.min(100,s);return new R({h:e,s:t,l:s})}}let O=e=>e,B;class k extends r.EventEmitter{constructor(e){super();this.cache=new c.Cache.MemoryCache;this.property="color";this.options=e;this.pseudoClass=null;this.setEventNamespace("BX.Landing.UI.Field.Processor.BaseProcessor")}getProperty(){return c.Type.isArray(this.property)?this.property:[this.property]}getVariableName(){return c.Type.isArray(this.variableName)?this.variableName:[this.variableName]}isNullValue(e){return c.Type.isNull(e)}getNullValue(){return new R}getPseudoClass(){return this.pseudoClass}getLayout(){return this.cache.remember("layout",(()=>this.buildLayout()))}buildLayout(){return c.Tag.render(B||(B=O`<div>Base processor</div>`))}getClassName(){return[this.className]}getValue(){}getStyle(){if(c.Type.isNull(this.getValue())){return{[this.getVariableName()]:null}}return{[this.getVariableName()]:this.getValue().getStyleString()}}setProcessorValue(e){const t=this.getVariableName()[this.getVariableName().length-1];this.cache.delete("value");this.setValue(e[t])}setDefaultValue(e){if(!c.Type.isNull(e)){const t=this.getProperty()[this.getProperty().length-1];if(t in e){this.setValue(e[t]);this.cache.delete("value");this.unsetActive();return}}this.setValue(null);this.cache.set("value",null)}setValue(e){}onReset(){this.emit("onReset")}unsetActive(){}onChange(){this.cache.delete("value");this.emit("onChange")}defineActiveControl(e,t){}setActiveControl(e){}prepareProcessorValue(e,t,s){return e}}let D=e=>e,x;class F extends r.EventEmitter{constructor(e){super();this.cache=new c.Cache.MemoryCache}getLayout(){return this.cache.remember("layout",(()=>this.buildLayout()))}buildLayout(){return c.Tag.render(x||(x=D`
			<div class="landing-ui-field-base-control">
				Base control
			</div>
		`))}getValue(){return this.cache.remember("value",(()=>new R))}isNeedSetValue(e){return e!==this.getValue()}setValue(e){this.cache.set("value",e)}onChange(e){this.cache.delete("value");this.emit("onChange",{color:this.getValue()})}setActive(){c.Dom.addClass(this.getLayout(),F.ACTIVE_CLASS)}unsetActive(){c.Dom.removeClass(this.getLayout(),F.ACTIVE_CLASS)}isActive(){return c.Dom.hasClass(this.getLayout(),F.ACTIVE_CLASS)}}F.ACTIVE_CLASS="active";let G=e=>e,M,H,U,$,X;class z extends F{constructor(){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Hex");this.previewMode=false;this.onInput=c.Runtime.debounce(this.onInput.bind(this),300);this.onButtonClick=this.onButtonClick.bind(this)}setPreviewMode(e){this.previewMode=!!e}buildLayout(){if(!this.previewMode){c.Event.bind(this.getInput(),"input",this.onInput);c.Event.bind(this.getButton(),"click",this.onButtonClick)}this.adjustColors(z.DEFAULT_COLOR,z.DEFAULT_BG);return c.Tag.render(M||(M=G`
			<div class="landing-ui-field-color-hex">
				${0}
				${0}
			</div>
		`),this.getInput(),this.getButton())}getInput(){return this.cache.remember("input",(()=>this.previewMode?c.Tag.render(H||(H=G`<div class="landing-ui-field-color-hex-preview">${0}</div>`),z.DEFAULT_TEXT):c.Tag.render(U||(U=G`<input type="text" name="hexInput" value="${0}" class="landing-ui-field-color-hex-input">`),z.DEFAULT_TEXT)))}getButton(){return this.cache.remember("editButton",(()=>this.previewMode?c.Tag.render($||($=G`
					<svg class="landing-ui-field-color-hex-preview-btn" width="9" height="9" xmlns="http://www.w3.org/2000/svg">
						<path
							d="M7.108 0l1.588 1.604L2.486 7.8.896 6.194 7.108 0zM.006 8.49a.166.166 0 00.041.158.161.161 0 00.16.042l1.774-.478L.484 6.715.006 8.49z"
							fill="#525C69"
							fill-rule="evenodd"/>
					</svg>`)):c.Tag.render(X||(X=G`
					<svg class="landing-ui-field-color-hex-preview-btn" width="12" height="9" xmlns="http://www.w3.org/2000/svg">
						<path
							d="M4.27 8.551L.763 5.304 2.2 3.902l2.07 1.846L9.836.533l1.439 1.402z"
							fill="#525C69"
							fill-rule="evenodd"/>
					</svg>`))))}onInput(){let e=this.getInput().value.replace(/[^\da-f]/gi,"");e=e.substring(0,6);this.getInput().value="#"+e.toLowerCase();this.onChange()}onButtonClick(){this.onChange();this.emit("onButtonClick",{color:this.getValue()})}onChange(e){const t=this.getInput().value.length===7&&d(this.getInput().value)?new R(this.getInput().value):null;this.setValue(t);this.cache.delete("value");this.emit("onChange",{color:t})}adjustColors(e,t){c.Dom.style(this.getInput(),"background-color",t);c.Dom.style(this.getInput(),"color",e);c.Dom.style(this.getButton().querySelector("path"),"fill",e)}focus(){if(!this.previewMode){if(this.getValue()===null){this.getInput().value="#"}this.getInput().focus()}}unFocus(){if(!this.previewMode){this.getInput().blur()}}getValue(){return this.cache.remember("value",(()=>this.getInput().value===z.DEFAULT_TEXT?null:new R(this.getInput().value)))}setValue(e){if(this.isNeedSetValue(e)){super.setValue(e);if(e!==null){this.adjustColors(e.getContrast().getHex(),e.getHex());this.setActive()}else{this.adjustColors(z.DEFAULT_COLOR,z.DEFAULT_BG);this.unsetActive()}if(this.previewMode){this.getInput().innerText=e!==null?e.getHex():z.DEFAULT_TEXT}else if(l.PageObject.getRootWindow().document.activeElement!==this.getInput()){this.getInput().value=e!==null?e.getHex():z.DEFAULT_TEXT}}}setActive(){c.Dom.addClass(this.getInput(),z.ACTIVE_CLASS)}unsetActive(){c.Dom.removeClass(this.getInput(),z.ACTIVE_CLASS)}isActive(){return c.Dom.hasClass(this.getInput(),z.ACTIVE_CLASS)}}z.DEFAULT_TEXT="#HEX";z.DEFAULT_COLOR="#000000";z.DEFAULT_BG="#eeeeee";let Y=e=>e,j,W;class Z extends F{static getDefaultSaturation(){const e=window.top.document.location.saturation;const t=new URL(window.top.document.location).searchParams.get("saturation");const s=e||t||Z.DEFAULT_SATURATION;window.top.document.body.style.setProperty("--saturation",s+"%");return parseInt(s)}constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Spectrum");this.onPickerDragStart=this.onPickerDragStart.bind(this);this.onPickerDragMove=this.onPickerDragMove.bind(this);this.onPickerDragEnd=this.onPickerDragEnd.bind(this);this.onScroll=this.onScroll.bind(this);this.document=l.PageObject.getRootWindow().document;this.scrollContext=e.contentRoot;c.Event.bind(this.getLayout(),"mousedown",this.onPickerDragStart)}buildLayout(){return c.Tag.render(j||(j=Y`
			<div class="landing-ui-field-color-spectrum">
				${0}
			</div>
		`),this.getPicker())}getPicker(){return this.cache.remember("picker",(()=>c.Tag.render(W||(W=Y`<div class="landing-ui-field-color-spectrum-picker"></div>`))))}getPickerPos(){return{x:c.Text.toNumber(c.Dom.style(this.getPicker(),"left")),y:c.Text.toNumber(c.Dom.style(this.getPicker(),"top"))}}onPickerDragStart(e){if(e.ctrlKey||e.metaKey||e.button){return}c.Event.bind(this.scrollContext,"scroll",this.onScroll);c.Event.bind(this.document,"mousemove",this.onPickerDragMove);c.Event.bind(this.document,"mouseup",this.onPickerDragEnd);c.Dom.addClass(this.document.body,"landing-ui-field-color-draggable");this.onScroll();this.showPicker();this.onPickerDragMove(e)}onPickerDragMove(e){if(e.target===this.getPicker()){return}this.setPickerPos(e.pageX,e.pageY);this.onChange()}onPickerDragEnd(){c.Event.unbind(this.scrollContext,"scroll",this.onScroll);c.Event.unbind(this.document,"mousemove",this.onPickerDragMove);c.Event.unbind(this.document,"mouseup",this.onPickerDragEnd);c.Dom.removeClass(this.document.body,"landing-ui-field-color-draggable")}onScroll(){this.cache.delete("layoutSize")}getLayoutRect(){return this.cache.remember("layoutSize",(()=>{const e=this.getLayout().getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,left:e.left}}))}setPickerPos(e,t){const{width:s,height:i,top:a,left:r}=this.getLayoutRect();let n=Math.min(Math.max(e-r,0),s);n=n>s/Z.HUE_RANGE*Z.HUE_RANGE_GRAY_THRESHOLD?s/Z.HUE_RANGE*Z.HUE_RANGE_GRAY_MIDDLE:n;c.Dom.style(this.getPicker(),{left:`${n}px`,top:`${Math.min(Math.max(t-a,0),i)}px`})}getValue(){return this.cache.remember("value",(()=>{if(c.Dom.hasClass(this.getPicker(),Z.HIDE_CLASS)){return null}const e=this.getLayout().getBoundingClientRect().width;const t=this.getPickerPos().x/e*Z.HUE_RANGE;const s=this.getLayout().getBoundingClientRect().height;const i=(1-this.getPickerPos().y/s)*100;if(isNaN(t)||isNaN(i)){return null}return new R({h:Math.min(t,Z.HUE_RANGE_GRAY_THRESHOLD),s:t>=Z.HUE_RANGE_GRAY_THRESHOLD?0:Z.getDefaultSaturation(),l:i})}))}setValue(e){super.setValue(e);if(e!==null&&Z.isSpectrumValue(e)){const{h:t,s:s,l:i}=e.getHsl();const a=s===0?Z.HUE_RANGE_GRAY_MIDDLE/Z.HUE_RANGE*100:t/Z.HUE_RANGE*100;c.Dom.style(this.getPicker(),"left",`${a}%`);const r=100-i;c.Dom.style(this.getPicker(),"top",`${r}%`);this.showPicker()}else{this.hidePicker()}}hidePicker(){c.Dom.addClass(this.getPicker(),Z.HIDE_CLASS)}showPicker(){c.Dom.removeClass(this.getPicker(),Z.HIDE_CLASS)}isActive(){return this.getValue()!==null&&Z.isSpectrumValue(this.getValue())}static isSpectrumValue(e){return e!==null&&(e.getHsl().s===Z.getDefaultSaturation()||e.getHsl().s===0)}}Z.DEFAULT_SATURATION=100;Z.HUE_RANGE=375;Z.HUE_RANGE_GRAY_THRESHOLD=360;Z.HUE_RANGE_GRAY_MIDDLE=367;Z.HIDE_CLASS="hidden";let q=e=>e,K,J;class Q extends r.EventEmitter{constructor(){super();this.cache=new c.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Recent")}getLayout(){this.initItems();return this.getLayoutContainer()}getLayoutContainer(){return this.cache.remember("layout",(()=>c.Tag.render(K||(K=q`<div class="landing-ui-field-color-recent"></div>`))))}initItems(){if(Q.itemsLoaded){this.buildItemsLayout()}else{o.Backend.getInstance().action("Utils::getUserOption",{name:Q.USER_OPTION_NAME}).then((e=>{if(e&&c.Type.isString(e.items)){Q.items=[];e.items.split(",").forEach((e=>{if(d(e)&&Q.items.length<Q.MAX_ITEMS){Q.items.push(e)}}));Q.itemsLoaded=true;this.buildItemsLayout()}}))}}buildItemsLayout(){c.Dom.clean(this.getLayoutContainer());Q.items.forEach((e=>{if(d(e)){let t=c.Tag.render(J||(J=q`<div 
					class="landing-ui-field-color-recent-item" 
					style="background:${0}"
					data-value="${0}"
				></div>`),e,e);c.Event.bind(t,"click",(()=>this.onItemClick(event)));c.Dom.append(t,this.getLayoutContainer())}}));return this}onItemClick(e){this.emit("onChange",{hex:e.currentTarget.dataset.value})}addItem(e){if(d(e)){let t=Q.items.indexOf(e);if(t!==-1){Q.items.splice(t,1)}Q.items.unshift(e);if(Q.items.length>Q.MAX_ITEMS){Q.items.splice(Q.MAX_ITEMS)}this.buildItemsLayout();this.saveItems()}return this}saveItems(){if(Q.items.length>0){BX.userOptions.save("landing",Q.USER_OPTION_NAME,"items",Q.items)}return this}}Q.USER_OPTION_NAME="color_field_recent_colors";Q.MAX_ITEMS=6;Q.items=[];Q.itemsLoaded=false;let ee=e=>e,te,se,ie,ae;class re extends F{constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Colorpicker");this.popupId="colorpicker_popup_"+c.Text.getRandom();this.popupTargetContainer=e.contentRoot;this.hexPreview=new z;this.hexPreview.setPreviewMode(true);c.Event.bind(this.hexPreview.getLayout(),"click",this.onPopupOpenClick.bind(this));this.hex=new z;this.hex.subscribe("onChange",this.onHexChange.bind(this));this.hex.subscribe("onButtonClick",this.onSelectClick.bind(this));this.spectrum=new Z(e);this.spectrum.subscribe("onChange",this.onSpectrumChange.bind(this));this.recent=new Q;this.recent.subscribe("onChange",this.onRecentChange.bind(this));c.Event.bind(this.getCancelButton(),"click",this.onCancelClick.bind(this));c.Event.bind(this.getSelectButton(),"click",this.onSelectClick.bind(this));this.previously=this.getValue()}onSelectClick(e){const t=e instanceof r.BaseEvent?e.getData().color:this.getValue();if(t!==null){this.recent.addItem(this.getValue().getHex())}this.getPopup().close()}buildLayout(){return c.Tag.render(te||(te=ee`
			<div class="landing-ui-field-color-colorpicker">
				${0}
			</div>
		`),this.hexPreview.getLayout())}getPopupContent(){return c.Tag.render(se||(se=ee`
			<div class="landing-ui-field-color-popup-container">
				<div class="landing-ui-field-color-popup-head">
					${0}
					${0}
				</div>
				${0}
				<div class="landing-ui-field-color-popup-footer">
					${0}
					${0}
				</div>
			</div>
		`),this.recent.getLayout(),this.hex.getLayout(),this.spectrum.getLayout(),this.getSelectButton(),this.getCancelButton())}getSelectButton(){return this.cache.remember("selectButton",(()=>c.Tag.render(ie||(ie=ee`
				<button class="ui-btn ui-btn-xs ui-btn-primary">
					${0}
				</button>
			`),c.Loc.getMessage("LANDING_FIELD_COLOR-BUTTON_SELECT"))))}getCancelButton(){return this.cache.remember("cancelButton",(()=>c.Tag.render(ae||(ae=ee`
				<button class="ui-btn ui-btn-xs ui-btn-light-border">
					${0}
				</button>
			`),c.Loc.getMessage("LANDING_FIELD_COLOR-BUTTON_CANCEL"))))}getHexPreviewObject(){return this.hexPreview}getPopup(){return this.cache.remember("popup",(()=>s.PopupManager.create({id:this.popupId,className:"landing-ui-field-color-spectrum-popup",autoHide:true,bindElement:this.hexPreview.getLayout(),bindOptions:{forceTop:true,forceLeft:true},padding:0,contentPadding:14,width:260,offsetTop:-37,offsetLeft:-180,content:this.getPopupContent(),closeByEsc:true,targetContainer:this.popupTargetContainer})))}getValue(){return this.cache.remember("value",(()=>this.spectrum.getValue()))}onHexChange(e){this.setValue(e.getData().color);this.onChange(e)}onSpectrumChange(e){this.hex.unFocus();this.setValue(e.getData().color);this.onChange(e)}onRecentChange(e){const t=new R(e.getData().hex);this.setValue(t);this.onChange(new r.BaseEvent({data:{color:t}}))}onCancelClick(){this.setValue(this.previously);this.getPopup().close();this.onChange(new r.BaseEvent({data:{color:this.getValue()}}))}onPopupOpenClick(){this.recent.buildItemsLayout();this.previously=this.getValue();this.getPopup().show();if(this.getPopup().isShown()){this.hex.focus()}}setValue(e){if(this.isNeedSetValue(e)){super.setValue(e);this.spectrum.setValue(e);this.hex.setValue(e);this.hexPreview.setValue(e)}this.setActivity(e)}setActivity(e){if(e!==null){if(this.spectrum.isActive()){this.hex.unsetActive()}else{this.hex.setActive()}this.hexPreview.setActive()}}unsetActive(){this.hex.unsetActive();this.hexPreview.unsetActive()}isActive(){return this.hex.isActive()||this.hexPreview.isActive()}}let ne=e=>e,oe;class le extends r.EventEmitter{constructor(){super();this.cache=new c.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Primary");c.Event.bind(this.getLayout(),"click",(()=>this.onClick()))}getLayout(){return this.cache.remember("layout",(()=>c.Tag.render(oe||(oe=ne`
				<div class="landing-ui-field-color-primary">
					<i class="landing-ui-field-color-primary-preview"></i>
					<span class="landing-ui-field-color-primary-text">
						${0}
					</span>
				</div>
			`),c.Loc.getMessage("LANDING_FIELD_COLOR-PRIMARY_TITLE"))))}getValue(){return this.cache.remember("value",(()=>new R(le.CSS_VAR)))}onClick(){this.setActive();this.emit("onChange",{color:this.getValue()})}setActive(){c.Dom.addClass(this.getLayout(),le.ACTIVE_CLASS)}unsetActive(){c.Dom.removeClass(this.getLayout(),le.ACTIVE_CLASS)}isActive(){return c.Dom.hasClass(this.getLayout(),le.ACTIVE_CLASS)}isPrimaryValue(e){return e!==null&&this.getValue().getCssVar()===e.getCssVar()}}le.ACTIVE_CLASS="active";le.CSS_VAR="--primary";function ce(e){return new RegExp(he(e))}function he(e){return e.source.replace(/(^\^)|(\$$)/g,"")}const ue=/^(linear|radial)-gradient\(.*\)$/i;const ge=/^(linear|radial)-gradient\(.*?((\d)+deg).*?\)$/gi;const de=he(g);const pe=new RegExp("((rgba|hsla)?\\([\\d% .,]+\\)|transparent|"+de+")+","ig");function me(e){return!!e.trim().match(ue)}class ve{constructor(e){this.value={from:new R("#ffffff"),to:new R(le.CSS_VAR),angle:ve.DEFAULT_ANGLE,type:ve.DEFAULT_TYPE};this.setValue(e)}getName(){return this.value.from.getName()+"_"+this.value.to.getName()+"_"+this.getAngle()+"_"+this.getType()}setValue(e){if(c.Type.isObject(e)){if(e instanceof ve){this.value.from=new R(e.getFrom());this.value.to=new R(e.getTo());this.value.angle=e.getAngle();this.value.type=e.getType()}else{if("from"in e){this.value.from=new R(e.from)}if("to"in e){this.value.to=new R(e.to)}if("angle"in e){this.value.angle=c.Text.toNumber(e.angle)}if("type"in e){this.value.type=e.type}}}else if(c.Type.isString(e)&&me(e)){this.parseGradientString(e)}return this}setOpacity(e){this.value.from.setOpacity(e);this.value.to.setOpacity(e);return this}parseGradientString(e){const t=e.trim().match(ue);if(!!t){this.setValue({type:t[1]})}const s=e.trim().match(ge);if(!!s){this.setValue({angle:s[2]})}const i=e.trim().match(pe);if(i&&i.length>0){this.setValue({from:new R(i[0])});this.setValue({to:new R(i[i.length-1])})}}getFrom(){return this.value.from}getTo(){return this.value.to}getAngle(){return this.value.angle}setAngle(e){if(c.Type.isNumber(e)){this.value.angle=Math.min(Math.max(e,0),360)}return this}getType(){return this.value.type}setType(e){if(e===ve.TYPE_RADIAL||e===ve.TYPE_LINEAR){this.value.type=e}return this}getOpacity(){var e;return(e=(this.value.from.getOpacity()+this.value.to.getOpacity())/2)!=null?e:_.a}getStyleString(){const e=this.value.angle;const t=this.value.type;const s=this.value.from.getStyleString();const i=this.value.to.getStyleString();return t==="linear"?`linear-gradient(${e}deg, ${s} 0%, ${i} 100%)`:`radial-gradient(circle farthest-side at 50% 50%, ${s} 0%, ${i} 100%)`}getStyleStringForOpacity(){return`radial-gradient(at top left, ${this.value.from.getHex()}, transparent)`+`, radial-gradient(at bottom left, ${this.value.to.getHex()}, transparent)`}static compare(e,t,s=true){const i=R.compare(e.getFrom(),t.getFrom())&&R.compare(e.getTo(),t.getTo())||R.compare(e.getTo(),t.getFrom())&&R.compare(e.getFrom(),t.getTo());const a=s?e.getAngle()===t.getAngle()&&e.getType()===t.getType():true;return i&&a}}ve.TYPE_RADIAL="radial";ve.TYPE_LINEAR="linear";ve.DEFAULT_ANGLE=180;ve.DEFAULT_TYPE="linear";const fe="color";const be="gradient";class ye{static getDefaultPresets(){return ye.cache.remember("default",(()=>{const e=[];ye.defaultPresets.forEach((t=>{e.push({id:t.id,type:"color",items:t.items.map((e=>new R(b(e))))})}));return e}))}static getPrimaryColorPreset(){return this.cache.remember("primary",(()=>{const e={id:"defaultPrimary",items:[]};const t=new R(c.Dom.style(document.documentElement,"--primary").trim());e.items.push(new R(t));if(t.getHsl().s<=10){const s=t.getHsl().l>50?Math.ceil(t.getHsl().l/100*5):Math.floor(t.getHsl().l/100*5);const i=5-s;const a=t.getHsl().l/(s+1);const r=(100-t.getHsl().l)/(i+1);for(let i=1;i<=s;i++){e.items.push(new R(t).darken(a*i))}for(let s=1;s<=i;s++){e.items.push(new R(t).lighten(r*s))}const n=15;const o=15;const l=new R(ye.BITRIX_COLOR);e.items[6]=new R(l);e.items[7]=new R(l.darken(n).saturate(o));e.items[8]=new R(l.darken(n).saturate(o));l.lighten(n*2).desaturate(o*2);e.items[9]=new R(l.lighten(n).desaturate(o));e.items[10]=new R(l.lighten(n).desaturate(o));l.darken(n*2).saturate(o*2);e.items[11]=new R(l).adjustHue(180)}else{const s=(90-t.getHsl().l)/3;const i=(t.getHsl().l-10)/3;const a=(90-t.getHsl().s)/3;const r=(t.getHsl().s-10)/3;e.items[1]=new R(t.darken(i).saturate(a));e.items[2]=new R(t.darken(i).saturate(a));e.items[3]=new R(t.darken(i).saturate(a));t.lighten(i*3).desaturate(a*3);e.items[4]=new R(t.desaturate(r).lighten(s));e.items[5]=new R(t.desaturate(r).lighten(s));e.items[11]=new R(t.desaturate(r).lighten(s));t.saturate(r*3).darken(s*3);e.items[7]=new R(t.adjustHue(40));e.items[8]=new R(t.adjustHue(-80));e.items[9]=new R(t.adjustHue(180));e.items[6]=new R(t.adjustHue(40));e.items[10]=new R(t.adjustHue(40))}return e}))}static getBlackAndWhitePreset(){return this.cache.remember("blackAndWhite",(()=>{const e={id:"blackAndWhite",items:[]};const t=new R("#ffffff");e.items.push(new R(t));e.items.push(new R(t.darken(14.28)));e.items.push(new R(t.darken(14.28)));e.items.push(new R(t.darken(14.28)));e.items.push(new R(t.darken(14.28)));e.items.push(new R(t.darken(14.28)));e.items.push(new R(t.darken(14.28)));e.items.push(new R(t.darken(14.32)));return e}))}static getGradientByColorOptions(e){const t=[];const s=[[1,2],[1,4],[5,12],[1,8],[8,9],[1,9],[10,7],[7,11]];s.forEach((s=>{t.push(new ve({from:new R(e.items[s[0]-1]),to:new R(e.items[s[1]-1]),angle:ve.DEFAULT_ANGLE,type:ve.DEFAULT_TYPE}))}));return{type:be,items:t}}}ye.BITRIX_COLOR="#2fc6f6";ye.cache=new c.Cache.MemoryCache;ye.defaultPresets=[{id:"agency",items:["#ff6366","#40191a","#803233","#bf4b4d","#e65a5c","#ffc1c2","#363643","#57dca3","#ee76ba","#ffa864","#eaeaec","#fadbdc"]},{id:"accounting",items:["#a5c33c","#384215","#6f8228","#8fa834","#b0cf40","#dae6ae","#4c4c4c","#5d84e6","#cd506b","#fe6466","#dfdfdf","#e9f0cf"]},{id:"app",items:["#4fd2c2","#1f524c","#379187","#46b8aa","#54dece","#c8f1ec","#6639b6","#e81c62","#9a69ca","#6279d8","#ffc337","#e9faf8"]},{id:"architecture",items:["#c94645","#4a1919","#8a2f2f","#b03c3c","#d64949","#eec3c3","#363643","#446d90","#a13773","#c98145","#eaeaec","#f9e8e7"]},{id:"business",items:["#3949a0","#232c61","#313e87","#3e4fad","#556ced","#d8d7dc","#14122c","#1d1937","#a03949","#2f295a","#c87014","#f4f4f5"]},{id:"charity",items:["#f5f219","#f58419","#f5cc19","#a8e32a","#f9f76a","#fcfbb6","#000000","#262e37","#74797f","#e569b1","#edeef0","#fefedf"]},{id:"construction",items:["#f7b70b","#382a02","#785905","#b88907","#dea509","#fdf1d1","#111111","#a3a3a3","#f7410b","#f70b4b","#d6dde9","#fef9ea"]},{id:"consulting",items:["#21a79b","#38afa5","#14665f","#1c8c83","#30f2e2","#a9ddd9","#ec4672","#58d400","#f0ac00","#2d6faf","#2da721","#e6f5f4"]},{id:"corporate",items:["#6ab8ee","#31556e","#4e86ad","#5fa3d4","#70c1fa","#d2e9f8","#36e2c0","#ffaa3c","#ee6a76","#ffa468","#5feb99","#ebf4fb"]},{id:"courses",items:["#6bda95","#2c593d","#4b9969","#5ebf83","#70e69d","#c2f0d3","#31556e","#ff947d","#738ed3","#f791ab","#ffb67d","#e2f8eb"]},{id:"event",items:["#f73859","#380d14","#781c2b","#b82a42","#de334f","#fdbbc6","#151726","#ffb553","#30d59b","#b265e0","#edeef0","#ffeaed"]},{id:"gym",items:["#6b7de0","#2f3661","#4d5aa1","#5f6fc7","#7284ed","#e4e8fa","#333333","#ffd367","#a37fe8","#e06b7d","#6dc1e0","#f4f6fd"]},{id:"lawyer",items:["#e74c3c","#69231b","#a8382c","#cf4536","#f55240","#f9d0cb","#4e4353","#5a505e","#e7863c","#38a27f","#e2e1e3","#fdeeec"]},{id:"photography",items:["#f7a700","#382600","#785200","#b87d00","#de9800","#fde8ba","#333333","#0b5aa0","#e93d18","#06c4ed","#3672a8","#fff6e3"]},{id:"restaurant",items:["#e6125d","#660829","#a60d43","#cc1052","#f21361","#facfde","#0eb88e","#00946f","#e04292","#9b12e6","#bfde00","#fef2f6"]},{id:"shipping",items:["#ff0000","#400000","#800000","#bf0000","#e60000","#ffb4b4","#333333","#ff822a","#d63986","#00ac6b","#ffb800","#fff3f3"]},{id:"spa",items:["#9dba04","#313b01","#667a02","#86a103","#a6c704","#e4ecb9","#ba7c04","#cf54bb","#049dba","#1d7094","#eead2f","#f2f6dd"]},{id:"travel",items:["#ee4136","#6e1f19","#ad3128","#d43c31","#fa4639","#fef1f0","#31353e","#3e434d","#ee8036","#428abc","#eaebec","#c3c4c7"]},{id:"wedding",items:["#d65779","#572431","#963e55","#bd4d6b","#e35d81","#f7dfe5","#af58a7","#6bc34b","#ec8c60","#50a098","#57b9d6","#fdf4f6"]}];let Ce=e=>e,Ae,Le;class Te extends r.EventEmitter{constructor(e){super();this.cache=new c.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Preset");this.id=e.id;this.type=e.type||fe;this.items=e.items;this.activeItem=null}getId(){return this.id}getGradientPreset(){const e=this.type===be?{type:be,items:this.items}:ye.getGradientByColorOptions({items:this.items});return new Te(e)}getLayout(){return this.cache.remember("layout",(()=>c.Tag.render(Ae||(Ae=Ce`
				<div class="landing-ui-field-color-preset">
					${0}
				</div>
			`),this.items.map((e=>this.getItemLayout(e.getName()))))))}getItemLayout(e){return this.cache.remember(e,(()=>{const t=this.getItemByName(e);const s=c.Type.isString(t)?t:t.getStyleString();const i=c.Tag.render(Le||(Le=Ce`
				<div
					class="landing-ui-field-color-preset-item"
					style="background: ${0}"
					data-name="${0}"
				></div>
			`),s,e);c.Event.bind(i,"click",this.onItemClick.bind(this));return i}))}getItemByName(e){return this.items.find((t=>e===t.getName()))||null}isPresetValue(e){if(e===null){return false}return this.items.some((t=>{if(t instanceof R&&e instanceof R){return R.compare(t,new R(e).setOpacity(1))}else if(t instanceof ve&&e instanceof ve){return ve.compare(t,e,false)}return false}))}onItemClick(e){this.setActiveItem(e.currentTarget.dataset.name);let t=null;if(this.activeItem!==null){t=this.activeItem instanceof ve?new ve(this.activeItem):new R(this.activeItem)}this.emit("onChange",{color:t})}setActiveItem(e){this.activeItem=this.getItemByName(e);this.items.forEach((t=>{const s=t.getName();if(e===s){c.Dom.addClass(this.getItemLayout(s),Te.ACTIVE_CLASS)}else{c.Dom.removeClass(this.getItemLayout(s),Te.ACTIVE_CLASS)}}))}setActiveValue(e){if(e!==null){if(e instanceof ve){this.setActiveItem(new ve(e).setAngle(ve.DEFAULT_ANGLE).setType(ve.DEFAULT_TYPE).getName())}else{this.setActiveItem(new R(e).setOpacity(1).getName())}}}unsetActive(){this.items.forEach((e=>{c.Dom.removeClass(this.getItemLayout(e.getName()),Te.ACTIVE_CLASS)}))}isActive(){return this.items.some((e=>c.Dom.hasClass(this.getItemLayout(e.getName()),Te.ACTIVE_CLASS)))}}Te.ACTIVE_CLASS="active";let Ee=e=>e,Ie,Ve,_e,Se,Pe;class Ne extends r.EventEmitter{constructor(e){super();this.presets={};this.activeId=null;this.cache=new c.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.PresetCollection");this.popupId="presets-popup_"+c.Text.getRandom();this.popupTargetContainer=e.contentRoot;this.onPresetClick=this.onPresetClick.bind(this);c.Event.bind(this.getOpenButton(),"click",(()=>{this.getPopup().toggle()}));this.onPresetChangeGlobal=this.onPresetChangeGlobal.bind(this);r.EventEmitter.subscribe("BX.Landing.UI.Field.Color.PresetCollection:onChange",this.onPresetChangeGlobal)}addDefaultPresets(){this.addPreset(ye.getPrimaryColorPreset());ye.getDefaultPresets().map((e=>{this.addPreset(e)}))}addPreset(e){this.cache.delete("popupLayout");if(!Object.keys(this.presets).length||!(e.id in this.presets)){this.presets[e.id]=e}}getGlobalActiveId(){return Ne.globalActiveId}getActiveId(){return this.getGlobalActiveId()||this.getDefaultPreset().getId()}getActivePreset(){return this.getPresetById(this.getActiveId())}getDefaultPreset(){return Object.keys(this.presets).length?this.getPresetById(Object.keys(this.presets)[0]):null}getPresetById(e){if(e in this.presets){return this.cache.remember(e,(()=>new Te(this.presets[e])))}else{return null}}getPresetByItemValue(e){if(e===null){return null}for(let t in this.presets){const s=this.getPresetById(t);if(s&&e instanceof R){if(s.isPresetValue(e)){return s}}else if(s&&e instanceof ve){if(s.getGradientPreset().isPresetValue(e)){return s}}}return null}getLayout(){return this.cache.remember("value",(()=>c.Tag.render(Ie||(Ie=Ee`
				<div class="landing-ui-field-color-presets">
					<div class="landing-ui-field-color-presets-left">
						<span class="landing-ui-field-color-presets-title">
							${0}
						</span>
					</div>
					<div class="landing-ui-field-color-presets-right">${0}</div>
				</div>
			`),c.Loc.getMessage("LANDING_FIELD_COLOR-PRESETS_TITLE"),this.getOpenButton())))}getOpenButton(){return this.cache.remember("openButton",(()=>c.Tag.render(Ve||(Ve=Ee`<span class="landing-ui-field-color-presets-open">
				${0}
			</span>`),c.Loc.getMessage("LANDING_FIELD_COLOR-PRESETS_MORE"))))}getTitleContainer(){return this.cache.remember("titleContainer",(()=>this.getLayout().querySelector(".landing-ui-field-color-presets-left")))}getPopup(){return this.cache.remember("popup",(()=>s.PopupManager.create({id:this.popupId,className:"presets-popup",autoHide:true,bindElement:this.getOpenButton(),bindOptions:{forceTop:true,forceLeft:true},width:280,offsetLeft:-200,content:this.getPopupLayout(),closeByEsc:true,targetContainer:this.popupTargetContainer})))}getPopupLayout(){return this.cache.remember("popupLayout",(()=>{const e=c.Tag.render(_e||(_e=Ee`<div class="landing-ui-field-color-presets-popup">
				<div class="landing-ui-field-color-presets-popup-title">
					${0}
				</div>
				<div class="landing-ui-field-color-presets-popup-inner"></div>
			</div>`),c.Loc.getMessage("LANDING_FIELD_COLOR-PRESETS_MORE_COLORS"));const t=e.querySelector(".landing-ui-field-color-presets-popup-inner");for(const e in this.presets){const s=this.getPresetLayout(e);if(e===this.getActiveId()){c.Dom.addClass(s,Ne.ACTIVE_CLASS);this.activeId=e}c.Event.bind(s,"click",this.onPresetClick);c.Dom.append(s,t)}return e}))}getPresetLayout(e){return this.cache.remember(e+"layout",(()=>c.Tag.render(Se||(Se=Ee`
				<div class="landing-ui-field-color-presets-preset" data-id="${0}">
					${0}
				</div>
			`),e,this.presets[e].items.map((e=>c.Tag.render(Pe||(Pe=Ee`<div
								class="landing-ui-field-color-presets-preset-item"
								style="background: ${0}"
							></div>`),c.Type.isString(e)?e:e.getStyleString()))))))}onPresetClick(e){this.getPopup().close();this.setActiveItem(e.currentTarget.dataset.id);this.emit("onChange",{presetId:this.getActiveId()})}onPresetChangeGlobal(e){if(e.getData().presetId!==this.activeId){this.setActiveItem(e.getData().presetId);this.emit("onChange",e)}}setActiveItem(e){if(e!==null&&e!==this.activeId){Ne.globalActiveId=e;this.activeId=e;for(const t in this.presets){c.Dom.removeClass(this.getPresetLayout(t),Ne.ACTIVE_CLASS);if(t===e){c.Dom.addClass(this.getPresetLayout(t),Ne.ACTIVE_CLASS)}}}}unsetActive(){for(const e in this.presets){c.Dom.removeClass(this.getPresetLayout(e),Ne.ACTIVE_CLASS)}}}Ne.globalActiveId=null;Ne.ACTIVE_CLASS="active";let we=e=>e,Re;class Oe extends r.EventEmitter{constructor(e){super();this.cache=new c.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Reset");c.Event.bind(this.getLayout(),"click",(()=>this.onClick()));const t=BX.UI.Hint.createInstance({popupParameters:{targetContainer:e.contentRoot,padding:0}});t.init(this.getLayout())}getLayout(){return this.cache.remember("layout",(()=>c.Tag.render(Re||(Re=we`
				<div class="landing-ui-field-color-reset-container">
					<div class="landing-ui-field-color-reset"
						data-hint="${0}"
						data-hint-no-icon
					>
					</div>
				</div>
			`),c.Loc.getMessage("LANDING_FIELD_COLOR-RESET_HINT_2"))))}onClick(){this.emit("onReset")}}let Be=e=>e,ke,De;class xe extends F{constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.ColorSet");this.reset=new Oe(e);this.reset.subscribe("onReset",(()=>{this.emit("onReset")}));this.blackAndWhitePreset=new Te(ye.getBlackAndWhitePreset());this.blackAndWhitePreset.subscribe("onChange",(e=>{this.preset.unsetActive();this.onPresetItemChange(e)}));this.colorpicker=new re(e);this.colorpicker.subscribe("onChange",(e=>{this.preset.unsetActive();this.blackAndWhitePreset.unsetActive();const t=e.getData().color;if(this.preset.isPresetValue(t)){this.preset.setActiveValue(t);this.colorpicker.unsetActive()}else if(this.blackAndWhitePreset.isPresetValue(t)){this.blackAndWhitePreset.setActiveValue(t);this.colorpicker.unsetActive()}this.onChange(e)}));this.presets=new Ne(e);this.presets.subscribe("onChange",(e=>{this.setPreset(this.presets.getPresetById(e.getData().presetId))}));this.presets.addDefaultPresets();const t=this.presets.getActivePreset();if(t){this.setPreset(t)}}buildLayout(){c.Dom.append(this.reset.getLayout(),this.presets.getTitleContainer());return c.Tag.render(ke||(ke=Be`
			<div class="landing-ui-field-color-colorset">
				<div class="landing-ui-field-color-colorset-top">
					${0}
				</div>
				${0}
				<div class="landing-ui-field-color-colorset-bottom">
					${0}
					${0}
				</div>
			</div>
		`),this.presets.getLayout(),this.getPresetContainer(),this.blackAndWhitePreset.getLayout(),this.colorpicker.getLayout())}getTitleLayout(){return this.cache.remember("titleLayout",(()=>this.getLayout().querySelector(".landing-ui-field-color-colorset-title")))}getPresetContainer(){return this.cache.remember("presetContainer",(()=>c.Tag.render(De||(De=Be`<div class="landing-ui-field-color-colorset-preset-container"></div>`))))}setPreset(e){this.preset=e;this.preset.unsetActive();if(this.getValue()!==null&&this.preset.isPresetValue(this.getValue())){this.unsetActive();this.preset.setActiveValue(this.getValue())}else{this.unsetActive();this.colorpicker.setValue(this.getValue())}this.preset.subscribe("onChange",(e=>{this.blackAndWhitePreset.unsetActive();this.onPresetItemChange(e)}));c.Dom.clean(this.getPresetContainer());c.Dom.append(e.getLayout(),this.getPresetContainer());this.emit("onPresetChange",{preset:e})}getPreset(){return this.preset}getPresetsCollection(){return this.presets}onPresetItemChange(e){this.colorpicker.setValue(e.getData().color);this.colorpicker.unsetActive();this.onChange(e)}onChange(e){this.cache.set("value",e.getData().color);this.emit("onChange",e)}getValue(){return this.cache.remember("value",(()=>this.colorpicker.getValue()))}setValue(e){if(this.isNeedSetValue(e)){super.setValue(e);this.colorpicker.setValue(e);const t=this.presets.getGlobalActiveId()?this.presets.getPresetById(this.presets.getGlobalActiveId()):this.presets.getPresetByItemValue(e);if(t!==null){this.setPreset(t);this.presets.setActiveItem(t.getId())}if(e!==null&&this.blackAndWhitePreset.isPresetValue(e)){this.unsetActive();this.blackAndWhitePreset.setActiveValue(e)}}}unsetActive(){this.preset.unsetActive();this.blackAndWhitePreset.unsetActive();this.colorpicker.unsetActive()}isActive(){return this.preset.isActive()||this.blackAndWhitePreset.isActive()||this.colorpicker.isActive()}}let Fe=e=>e,Ge,Me,He;class Ue extends F{constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Opacity");this.defaultOpacity=c.Type.isObject(e)&&Reflect.has(e,"defaultOpacity")?e.defaultOpacity:Ue.DEFAULT_OPACITY;this.document=l.PageObject.getRootWindow().document;this.onPickerDragStart=this.onPickerDragStart.bind(this);this.onPickerDragMove=this.onPickerDragMove.bind(this);this.onPickerDragEnd=this.onPickerDragEnd.bind(this);this.layout=this.getLayout();this.pickerControl=this.layout.querySelector(".landing-ui-field-color-opacity");this.rangeControl=this.layout.querySelector(".landing-ui-field-color-opacity-range-output");this.arrowsUp=this.rangeControl.querySelector(".landing-ui-field-color-opacity-range-output-arrows-up");this.arrowsDown=this.rangeControl.querySelector(".landing-ui-field-color-opacity-range-output-arrows-down");this.rangeInput=this.rangeControl.querySelector(".landing-ui-field-color-opacity-range-output-input");c.Event.bind(this.arrowsUp,"click",this.onArrowClick.bind(this,"up"));c.Event.bind(this.arrowsDown,"click",this.onArrowClick.bind(this,"down"));c.Event.bind(this.pickerControl,"mousedown",this.onPickerDragStart)}buildLayout(){const e=this.defaultOpacity*100;const t=c.Tag.render(Ge||(Ge=Fe`
			<div class="landing-ui-field-color-opacity-container">
				<div class="landing-ui-field-color-opacity">
					${0}
					${0}
				</div>
				<div class="landing-ui-field-color-opacity-range-output">
					<div 
						class="landing-ui-field-color-opacity-range-output-input"
						title="${0}">
						${0}
					</div>
					<div class="landing-ui-field-color-opacity-range-output-arrows">
						<div class="landing-ui-field-color-opacity-range-output-arrows-up"></div>
						<div class="landing-ui-field-color-opacity-range-output-arrows-down"></div>
					</div>
				</div>
			</div>
		`),this.getPicker(),this.getColorLayout(),e,e);this.setPickerPosByOpacity(this.defaultOpacity);return t}onPickerDragStart(e){if(e.ctrlKey||e.metaKey||e.button){return}c.Event.bind(this.document,"mousemove",this.onPickerDragMove);c.Event.bind(this.document,"mouseup",this.onPickerDragEnd);c.Dom.addClass(this.document.body,"landing-ui-field-color-draggable");this.onPickerDragMove(e)}onPickerDragMove(e){if(e.target===this.getPicker()){return}this.setPickerPos(e.pageX);this.onChange();this.onRangeControlChange()}onPickerDragEnd(){c.Event.unbind(this.document,"mousemove",this.onPickerDragMove);c.Event.unbind(this.document,"mouseup",this.onPickerDragEnd);c.Dom.removeClass(this.document.body,"landing-ui-field-color-draggable")}setPickerPos(e){const t=Math.max(Math.min(e-this.getLayoutRect().left,this.getLayoutRect().width),0);c.Dom.style(this.getPicker(),{left:`${t}px`})}setPickerPosByOpacity(e){e=Math.min(1,Math.max(0,e));c.Dom.style(this.getPicker(),{left:`${e*100}%`})}getLayoutRect(){return this.cache.remember("layoutSize",(()=>{const e=this.pickerControl.getBoundingClientRect();return{width:e.width,left:e.left}}))}getColorLayout(){return this.cache.remember("colorLayout",(()=>c.Tag.render(Me||(Me=Fe`
				<div class="landing-ui-field-color-opacity-color"></div>
			`))))}getPicker(){return this.cache.remember("picker",(()=>c.Tag.render(He||(He=Fe`
				<div class="landing-ui-field-color-opacity-picker">
					<div class="landing-ui-field-color-opacity-picker-item">
						<div class="landing-ui-field-color-opacity-picker-item-circle"></div>
					</div>
				</div>`))))}getDefaultValue(){return this.cache.remember("default",(()=>new R(Ue.DEFAULT_COLOR).setOpacity(this.defaultOpacity)))}getValue(){return this.cache.remember("value",(()=>{const e=c.Text.toNumber(c.Dom.style(this.getPicker(),"left"));const t=c.Text.toNumber(this.pickerControl.getBoundingClientRect().width);return this.getDefaultValue().setOpacity(e/t)}))}setValue(e){const t=!c.Type.isNull(e)?e:this.getDefaultValue();super.setValue(t);if(!c.Type.isNull(e)){c.Dom.style(this.getColorLayout(),{background:t.getStyleStringForOpacity()});this.setPickerPosByOpacity(t.getOpacity());this.onRangeControlChange()}else{c.Dom.style(this.getColorLayout(),{background:"none"})}}onRangeControlChange(){const e=parseInt(this.getValue().getOpacity()*100);this.rangeInput.title=e;this.rangeInput.innerHTML=e}onArrowClick(e){let t;const s=this.getValue().getOpacity();const i=parseInt(s*100);if(e==="up"){if(i<100){t=(i+5)/100}else{t=i/100}}if(e==="down"){if(i>0){t=(i-5)/100}else{t=i/100}}this.rangeInput.title=parseInt(t*100);this.rangeInput.innerHTML=parseInt(t*100);const a=this.pickerControl.getBoundingClientRect().width;const r=a-a*(1-t);c.Dom.style(this.getPicker(),{left:`${r}px`});this.onChange()}}Ue.DEFAULT_COLOR="#cccccc";Ue.DEFAULT_OPACITY=1;let $e=e=>e,Xe,ze,Ye,je,We,Ze;class qe extends r.EventEmitter{constructor(){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Tabs");this.tabs=[];this.cache=new c.Cache.MemoryCache;this.multiple=true;this.isBig=false;this.onToggle=this.onToggle.bind(this)}setMultiple(e){this.multiple=e;return this}setBig(e){this.isBig=e;this.multiple=false;return this}appendTab(e,t,s){const i=new Ke({id:e,title:t,items:c.Type.isArray(s)?s:[s]});this.tabs.push(i);this.bindEvents(i);this.cache.delete("layout");return this}prependTab(e,t,s){const i=new Ke({id:e,title:t,items:c.Type.isArray(s)||[s]});this.tabs.unshift(i);this.bindEvents(i);this.cache.delete("layout");return this}bindEvents(e){e.subscribe("onToggle",this.onToggle);e.subscribe("onShow",this.onToggle);e.subscribe("onHide",this.onToggle)}onToggle(e){this.emit("onToggle",e)}showTab(e){if(!this.multiple){this.tabs.forEach((e=>{e.hide()}))}const t=this.getTabById(e);if(t){t.show()}return this}getTabById(e){return this.tabs.find((t=>t.id===e))}getLayout(){return this.cache.remember("layout",(()=>{const e=this.isBig?" landing-ui-field-color-tabs--big":"";const t=c.Tag.render(Xe||(Xe=$e`<div class="landing-ui-field-color-tabs${0}"></div>`),e);if(this.isBig){const e=c.Tag.render(ze||(ze=$e`
					<div class="landing-ui-field-color-tabs-head landing-ui-field-color-tabs-head--big"></div>
				`));const s=c.Tag.render(Ye||(Ye=$e`
					<div class="landing-ui-field-color-tabs-content landing-ui-field-color-tabs-content--big"></div>
				`));this.tabs.forEach((t=>{c.Dom.append(t.getTitle(),e);c.Dom.append(t.getLayout(),s)}));c.Dom.append(e,t);c.Dom.append(s,t)}else{this.tabs.forEach((e=>{const s=c.Tag.render(je||(je=$e`<div class="landing-ui-field-color-tabs-tab">
						${0}${0}
					</div>`),e.getTitle(),e.getLayout());c.Dom.append(s,t)}))}this.tabs.forEach((e=>{c.Event.bind(e.getTitle(),"click",(()=>{if(!this.multiple){this.tabs.forEach((e=>{e.hide()}))}e.toggle()}))}));return t}))}}class Ke extends r.EventEmitter{constructor(e){super();this.id=e.id;this.title=e.title;this.items=e.items;this.cache=new c.Cache.MemoryCache}getId(){return this.id}getTitle(){return this.cache.remember("title",(()=>c.Tag.render(We||(We=$e`
				<span class="landing-ui-field-color-tabs-tab-toggler">
					<span class="landing-ui-field-color-tabs-tab-toggler-icon"></span>
					<span class="landing-ui-field-color-tabs-tab-toggler-name">${0}</span>
				</span>
			`),this.title)))}getLayout(){return this.cache.remember("layout",(()=>c.Tag.render(Ze||(Ze=$e`
				<div class="landing-ui-field-color-tabs-tab-content">
					${0}
				</div>
			`),this.items.map((e=>e.getLayout())))))}toggle(){c.Dom.toggleClass(this.getLayout(),Ke.SHOW_CLASS);c.Dom.toggleClass(this.getTitle(),Ke.SHOW_CLASS);this.emit("onToggle",{tab:this.title});return this}show(){c.Dom.addClass(this.getLayout(),Ke.SHOW_CLASS);c.Dom.addClass(this.getTitle(),Ke.SHOW_CLASS);this.emit("onShow",{tab:this.title});return this}hide(){c.Dom.removeClass(this.getLayout(),Ke.SHOW_CLASS);c.Dom.removeClass(this.getTitle(),Ke.SHOW_CLASS);this.emit("onHide",{tab:this.title});return this}}Ke.SHOW_CLASS="show";let Je=e=>e,Qe;class et extends r.EventEmitter{constructor(e){super();this.options=e;this.cache=new c.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Zeroing");c.Event.bind(this.getLayout(),"click",(()=>this.onClick()))}getLayout(){let e="LANDING_FIELD_COLOR-ZEROING_TITLE_2";if(this.options){if(this.options.textCode){e=this.options.textCode}}return this.cache.remember("layout",(()=>c.Tag.render(Qe||(Qe=Je`<div class="landing-ui-field-color-zeroing">
				<div class="landing-ui-field-color-zeroing-preview">
					<div class="landing-ui-field-color-zeroing-state"></div>
				</div>
				<span class="landing-ui-field-color-primary-text">
					${0}
				</span>
			</div>`),c.Loc.getMessage(e))))}onClick(){this.emit("onChange",{color:null})}setActive(){c.Dom.addClass(this.getLayout(),et.ACTIVE_CLASS)}unsetActive(){c.Dom.removeClass(this.getLayout(),et.ACTIVE_CLASS)}isActive(){return c.Dom.hasClass(this.getLayout(),et.ACTIVE_CLASS)}}et.ACTIVE_CLASS="active";let tt=e=>e,st;class it extends k{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.Color");this.property="color";this.variableName="--color";this.className="g-color";this.colorSet=new xe(e);this.colorSet.subscribe("onChange",this.onColorSetChange.bind(this));this.colorSet.subscribe("onReset",this.onReset.bind(this));this.opacity=new Ue;this.opacity.subscribe("onChange",this.onOpacityChange.bind(this));this.zeroing=new et;this.zeroing.subscribe("onChange",this.onZeroingChange.bind(this));this.primary=new le;this.primary.subscribe("onChange",this.onPrimaryChange.bind(this));this.tabs=(new qe).appendTab("Opacity",c.Loc.getMessage("LANDING_FIELD_COLOR-TAB_OPACITY"),this.opacity)}isNullValue(e){return e===null||e==="none"||e==="rgba(0, 0, 0, 0)"}getNullValue(){return new R("rgba(0, 0, 0, 0)")}buildLayout(){return c.Tag.render(st||(st=tt`
			<div class="landing-ui-field-color-color">
				${0}
				${0}
				${0}
				${0}
			</div>
		`),this.colorSet.getLayout(),this.primary.getLayout(),this.zeroing.getLayout(),this.tabs.getLayout())}onColorSetChange(e){this.primary.unsetActive();this.zeroing.unsetActive();const t=e.getData().color;if(t!==null){t.setOpacity(this.opacity.getValue().getOpacity())}this.opacity.setValue(t);this.onChange()}onOpacityChange(){this.onChange()}onPrimaryChange(e){this.colorSet.setValue(e.getData().color);this.onColorSetChange(e);this.colorSet.unsetActive();this.zeroing.unsetActive();this.primary.setActive()}onZeroingChange(e){this.colorSet.unsetActive();this.primary.unsetActive();this.zeroing.setActive();this.setValue(e.getData().color);this.onChange(e)}unsetActive(){this.colorSet.unsetActive();this.primary.unsetActive()}setValue(e){const t=e!==null?new R(e):null;this.colorSet.setValue(t);this.opacity.setValue(t);if(this.primary.isPrimaryValue(t)){this.primary.setActive();this.colorSet.unsetActive()}if(e!==null&&t.getOpacity()<1){this.tabs.showTab("Opacity")}}getValue(){return this.cache.remember("value",(()=>{const e=this.primary.isActive()?this.primary.getValue():this.colorSet.getValue();return e===null?null:e.setOpacity(this.opacity.getValue().getOpacity())}))}setDefaultValue(e){this.zeroing.setActive();if(!c.Type.isNull(e)){this.colorSet.colorpicker.hex.setActive()}super.setDefaultValue(e)}onReset(){this.zeroing.unsetActive();super.onReset()}setActiveControl(e){if(e==="primary"){this.primary.setActive()}if(e==="hex"){this.colorSet.colorpicker.hexPreview.setActive()}}defineActiveControl(e,t){if(!c.Type.isUndefined(t)){let s;let i;const a=t.getNode();if(a.length>0){e.forEach((e=>{if(c.Dom.hasClass(a[0],e.value)){s=e.value}}));if(s){const e=/g-[a-z]+-[a-z0-9-]+/i;const t=s.match(e);if(t){const e=/primary/i;const t=s.match(e);this.zeroing.unsetActive();if(t){i="primary"}else{i="hex"}}}if(i){this.setActiveControl(i)}}}}}it.PRIMARY_VAR="var(--primary)";class at extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.ColorHover");this.property="color";this.variableName="--color-hover";this.className="g-color--hover";this.pseudoClass=":hover"}}let rt=e=>e,nt,ot,lt,ct,ht,ut,gt;class dt extends F{constructor(e){super();this.ROTATE_STEP=45;this.setEventNamespace("BX.Landing.UI.Field.Color.Gradient");this.popupId="gradient_popup_"+c.Text.getRandom();this.popupTargetContainer=e.contentRoot;this.colorpickerFrom=new re(e);this.colorpickerFrom.subscribe("onChange",(e=>{this.onColorChange(e.getData().color,null)}));this.colorpickerTo=new re(e);this.colorpickerTo.subscribe("onChange",(e=>{this.onColorChange(null,e.getData().color)}));c.Event.bind(this.getPopupButton(),"click",this.onPopupOpen.bind(this));c.Event.bind(this.getRotateButton(),"click",this.onRotate.bind(this));c.Event.bind(this.getSwitchTypeButton(),"click",this.onSwitchType.bind(this));c.Event.bind(this.getSwapButton(),"click",this.onSwap.bind(this));this.preset=null}onColorChange(e,t){if(e===null&&t===null){return}const s=this.getValue()||new ve;const i=e||s.getFrom()||(new ve).getFrom();const a=t||s.getTo()||(new ve).getTo();s.setValue({from:i,to:a});this.setValue(s);this.preset.unsetActive();this.onChange()}onPopupOpen(){this.getPopup().toggle()}onRotate(e){if(!dt.isButtonEnable(e.target)){return}const t=this.getValue();if(t!==null){t.setValue({angle:(t.getAngle()+this.ROTATE_STEP)%360});this.setValue(t);this.onChange()}this.getPopup().close()}onSwitchType(e){if(!dt.isButtonEnable(e.target)){return}const t=this.getValue();if(t!==null){if(t.getType()===ve.TYPE_LINEAR){t.setValue({type:ve.TYPE_RADIAL});dt.disableButton(this.getRotateButton())}else{t.setValue({type:ve.TYPE_LINEAR});dt.enableButton(this.getRotateButton())}this.setValue(t);this.onChange()}this.getPopup().close()}onSwap(e){if(!dt.isButtonEnable(e.target)){return}const t=this.getValue();if(t!==null){t.setValue({to:t.getFrom(),from:t.getTo()});this.setValue(t);this.onChange()}this.getPopup().close()}static disableButton(e){c.Dom.addClass(e,dt.DISABLE_CLASS)}static enableButton(e){c.Dom.removeClass(e,dt.DISABLE_CLASS)}static isButtonEnable(e){return!c.Dom.hasClass(e,dt.DISABLE_CLASS)}correctColorpickerColors(){const e=this.getValue();if(e!==null){const t=e.getAngle();const s=this.colorpickerFrom.getHexPreviewObject();const i=this.colorpickerTo.getHexPreviewObject();const a=e.getFrom();const r=e.getTo();if(e.getType()===ve.TYPE_LINEAR){if(t===270||t===90){const e=R.getMedian(a,r).getContrast().getHex();s.adjustColors(e,"transparent");i.adjustColors(e,"transparent")}else if(t>=135&&t<=225){s.adjustColors(a.getContrast().getHex(),"transparent");i.adjustColors(r.getContrast().getHex(),"transparent")}else{s.adjustColors(r.getContrast().getHex(),"transparent");i.adjustColors(a.getContrast().getHex(),"transparent")}}else if(e.getType()===ve.TYPE_RADIAL){s.adjustColors(r.getContrast().getHex(),"transparent");i.adjustColors(r.getContrast().getHex(),"transparent")}}}getPopup(){return this.cache.remember("popup",(()=>s.PopupManager.create({id:this.popupId,className:"landing-ui-field-color-gradient-preset-popup",autoHide:true,bindElement:this.getPopupButton(),bindOptions:{forceTop:true,forceLeft:true},offsetLeft:15,angle:{offset:-5},padding:0,contentPadding:7,content:this.getPopupContent(),closeByEsc:true,targetContainer:this.popupTargetContainer})))}getPopupContent(){return this.cache.remember("popupContainer",(()=>c.Tag.render(nt||(nt=rt`
				<div class="landing-ui-field-color-gradient-preset-popup-container">
					${0}
					${0}
				</div>
			`),this.getRotateButton(),this.getSwapButton())))}buildLayout(){if(this.preset){c.Dom.clean(this.getPresetContainer());c.Dom.append(this.preset.getLayout(),this.getPresetContainer())}return c.Tag.render(ot||(ot=rt`
			<div class="landing-ui-field-color-gradient">
				${0}
				<div class="landing-ui-field-color-gradient-container">
					<div class="landing-ui-field-color-gradient-from">${0}</div>
					${0}
					<div class="landing-ui-field-color-gradient-to">${0}</div>
				</div>
				<div class="landing-ui-field-color-gradient-switch-type-container">
					${0}
				</div>
			</div>
		`),this.getPresetContainer(),this.colorpickerFrom.getLayout(),this.getPopupButton(),this.colorpickerTo.getLayout(),this.getSwitchTypeButton())}getContainerLayout(){return this.getLayout().querySelector(".landing-ui-field-color-gradient-container")}getPresetContainer(){return this.cache.remember("presetContainer",(()=>c.Tag.render(lt||(lt=rt`<div class="landing-ui-field-color-gradient-preset-container"></div>`))))}getPopupButton(){return this.cache.remember("popupButton",(()=>c.Tag.render(ct||(ct=rt`<span class="landing-ui-field-color-gradient-open-popup"></span>`))))}getSwitchTypeButton(){return this.cache.remember("switchTypeButton",(()=>c.Tag.render(ht||(ht=rt`
				<span
					class="landing-ui-field-color-gradient-switch-type"
					title="${0}"
				></span>`),c.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_SWITCH_TYPE"))))}getRotateButton(){return this.cache.remember("rotateButton",(()=>c.Tag.render(ut||(ut=rt`
				<span
					class="landing-ui-field-color-gradient-rotate"
					title="${0}"
				></span>`),c.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_ROTATE"))))}getSwapButton(){return this.cache.remember("swapButton",(()=>c.Tag.render(gt||(gt=rt`
				<span
					class="landing-ui-field-color-gradient-swap"
					title="${0}"
				></span>`),c.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_SWAP"))))}setPreset(e){this.preset=e;this.preset.unsetActive();this.preset.subscribe("onChange",(e=>{this.setValue(e.getData().color);this.unsetColorpickerActive();this.onChange(e)}));c.Dom.clean(this.getPresetContainer());c.Dom.append(e.getLayout(),this.getPresetContainer())}getPreset(){return this.preset}getValue(){return this.cache.remember("value",(()=>{if(this.colorpickerFrom.getValue()===null||this.colorpickerTo.getValue()===null){return null}let e=this.getRotateButton().dataset.rotate;e=e?c.Text.toNumber(e):0;const t=this.getSwitchTypeButton().dataset.type||ve.TYPE_LINEAR;return new ve({from:this.colorpickerFrom.getValue(),to:this.colorpickerTo.getValue(),angle:e,type:t})}))}setValue(e){super.setValue(e);if(e===null){this.colorpickerFrom.setValue(null);this.colorpickerTo.setValue(null);this.unsetActive();c.Dom.style(this.getContainerLayout(),"background",(new ve).getStyleString());dt.disableButton(this.getRotateButton());dt.disableButton(this.getSwitchTypeButton());dt.disableButton(this.getSwapButton())}else{this.colorpickerFrom.setValue(e.getFrom());this.colorpickerTo.setValue(e.getTo());this.correctColorpickerColors();this.getRotateButton().dataset.rotate=e.getAngle();this.getSwitchTypeButton().dataset.type=e.getType();c.Dom.style(this.getRotateButton(),"transform",`rotate(${e.getAngle()}deg)`);c.Dom.style(this.getContainerLayout(),"background",this.getValue().getStyleString());dt.enableButton(this.getSwitchTypeButton());dt.enableButton(this.getSwapButton());if(e.getType()===ve.TYPE_RADIAL){dt.disableButton(this.getRotateButton());this.getSwitchTypeButton().innerText=c.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_DO_LINEAR")}else{dt.enableButton(this.getRotateButton());this.getSwitchTypeButton().innerText=c.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_DO_RADIAL")}this.setActive()}}onChange(e){this.cache.delete("value");this.emit("onChange",{gradient:this.getValue()})}setActive(){const e=this.getValue();if(this.preset.isPresetValue(e)){this.preset.setActiveValue(e);this.unsetColorpickerActive()}else{this.preset.unsetActive();this.setColorpickerActive()}}unsetActive(){this.preset.unsetActive();this.unsetColorpickerActive()}setColorpickerActive(){c.Dom.addClass(this.getContainerLayout(),dt.ACTIVE_CLASS)}unsetColorpickerActive(){this.colorpickerFrom.unsetActive();this.colorpickerTo.unsetActive();c.Dom.removeClass(this.getContainerLayout(),dt.ACTIVE_CLASS)}}dt.DISABLE_CLASS="disable";class pt extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BgColor");this.property=["background-image","background-color"];this.variableName="--bg";this.className="g-bg";this.activeControl=null;this.gradient=new dt(e);this.gradient.subscribe("onChange",this.onGradientChange.bind(this));this.tabs.prependTab("Gradient",c.Loc.getMessage("LANDING_FIELD_COLOR-TAB_GRADIENT"),this.gradient);this.setGradientPreset(this.colorSet.getPreset());this.colorSet.subscribe("onPresetChange",(e=>{this.setGradientPreset(e.getData().preset)}));this.tabs.subscribe("onToggle",this.onTabsToggle.bind(this))}setGradientPreset(e){const t=e.getGradientPreset();this.gradient.setPreset(t);t.subscribe("onChange",(()=>{this.activeControl=this.gradient;this.onChange()}));const s=this.getValue();if(s!==null&&s instanceof ve){if(this.gradient.getPreset().isPresetValue(s)){this.colorSet.getPreset().unsetActive();this.gradient.getPreset().setActiveValue(s);this.gradient.unsetColorpickerActive()}}}onColorSetChange(e){this.activeControl=this.colorSet;this.gradient.unsetActive();super.onColorSetChange(e)}onGradientChange(e){this.activeControl=this.gradient;this.colorSet.unsetActive();const t=e.getData().gradient;if(t!==null){this.opacity.setValue(t.setOpacity(this.opacity.getValue().getOpacity()))}this.onChange()}onOverlayOpacityChange(){this.onChange()}onTabsToggle(){this.gradient.getPopup().close()}unsetActive(){this.colorSet.unsetActive();this.gradient.unsetActive();this.primary.unsetActive()}setValue(e){this.colorSet.setValue(null);this.gradient.setValue(null);this.unsetActive();this.activeControl=null;if(c.Type.isNil(e));else if(u(e)||d(e)||m(e)||I(e)){super.setValue(e);this.activeControl=this.colorSet}else if(me(e)){this.activeControl=this.gradient;const t=new ve(e);this.gradient.setValue(t);this.opacity.setValue(t);const s=this.colorSet.getPresetsCollection();const i=s.getGlobalActiveId()?s.getPresetById(s.getGlobalActiveId()):s.getPresetByItemValue(t);if(i!==null&&i!==this.colorSet.getPreset()){this.colorSet.setPreset(i);this.setGradientPreset(i)}this.tabs.showTab("Gradient");if(t.getOpacity()<1){this.tabs.showTab("Opacity")}}}getValue(){return this.cache.remember("value",(()=>{if(this.activeControl===null){return null}else if(this.activeControl===this.gradient){const e=this.gradient.getValue();return e===null?e:e.setOpacity(this.opacity.getValue().getOpacity())}else{return super.getValue()}}))}}const mt=/url\(['"]?([^ '"]*)['"]?\)([\w \/]*)/i;function vt(e){if(!!e.trim().match(mt)){return true}return!!e.trim().match(ft())}function ft(){const e=he(mt);const t=he(ue);return new RegExp(`^${t},${e}`)}class bt{constructor(e){this.value=w;this.setValue(e)}getName(){return`\n\t\t\t${this.value.url.replace(/[^\w\d]/g,"")}_${this.value.size}_${this.value.attachment}\n\t\t`}setValue(e){if(c.Type.isObject(e)){if(e instanceof bt){this.value.url=e.getUrl();this.value.url2x=e.getUrl2x();this.value.fileId=e.getFileId();this.value.fileId2x=e.getFileId2x();this.value.size=e.getSize();this.value.attachment=e.getAttachment()}else{this.value={...this.value,...e}}}if(c.Type.isString(e)&&vt(e)){this.parseBgString(e)}return this}parseBgString(e){const t=w;const s=e.trim().match(ce(mt));if(!!s){t.url=s[1];t.size=s[2].indexOf("auto")===-1?S:"auto";t.attachment=s[2].indexOf("fixed")===-1?P:"fixed"}const i=e.trim().match(ce(pe));if(!!e.trim().match(ce(ue))&&!!i){t.overlay=new R(i[0])}this.setValue(t)}setOpacity(e){return this}setUrl(e){this.setValue({url:e});return this}setUrl2x(e){this.setValue({url2x:e});return this}setFileId(e){this.setValue({fileId:e});return this}setFileId2x(e){this.setValue({fileId2x:e});return this}setSize(e){this.setValue({size:e});return this}setAttachment(e){this.setValue({attachment:e});return this}setOverlay(e){this.setValue({overlay:e});return this}getUrl(){return this.value.url}getUrl2x(){return this.value.url2x}getFileId(){return this.value.fileId}getFileId2x(){return this.value.fileId2x}getSize(){return this.value.size}getAttachment(e=false){return e?this.value.attachment==="fixed":this.value.attachment}getOverlay(){return this.value.overlay}getOpacity(){return 1}getStyleString(){let e="";if(this.value.overlay!==null){e=`linear-gradient(${this.value.overlay.getStyleString()},${this.value.overlay.getStyleString()})`}const{url:t,url2x:s,size:i,attachment:a}=this.value;const r=`center / ${i} ${a}`;if(t!==null){e=e.length?e+",":"";if(s!==null){e+=`-webkit-image-set(url('${t}') 1x, url('${s}') 2x) ${r},`;e+=`image-set(url('${t}') 1x, url('${s}') 2x) ${r},`}e+=`url('${t}') ${r}`}return e}getStyleStringForOpacity(){return""}static getSizeItemsForButtons(){return[{name:c.Loc.getMessage("LANDING_FIELD_COLOR-BG_COVER"),value:"cover"},{name:c.Loc.getMessage("LANDING_FIELD_COLOR-BG_MOSAIC"),value:"auto"}]}static getAttachmentValueByBool(e){return e?"fixed":"scroll"}}let yt=e=>e,Ct;class At extends F{constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Image");this.options=e;this.imgField=new n.Image({id:"landing_ui_color_image_"+c.Text.getRandom().toLowerCase(),className:"landing-ui-field-color-image-image",contextType:n.Image.CONTEXT_TYPE_STYLE,compactMode:true,disableLink:true,disableAltField:true,allowClear:true,dimensions:{width:1920},uploadParams:{action:"Block::uploadFile",block:this.options.block.id},contentRoot:this.options.contentRoot});this.imgField.subscribe("change",this.onImageChange.bind(this));this.sizeField=new BX.Landing.UI.Field.Dropdown({id:"landing_ui_color_image_size_"+c.Text.getRandom().toLowerCase(),title:c.Loc.getMessage("LANDING_FIELD_COLOR-BG_SIZE_TITLE"),className:"landing-ui-field-color-image-size",items:bt.getSizeItemsForButtons(),onChange:this.onSizeChange.bind(this),contentRoot:this.options.contentRoot});this.attachmentField=new BX.Landing.UI.Field.Checkbox({id:"landing_ui_color_image_attach_"+c.Text.getRandom().toLowerCase(),className:"landing-ui-field-color-image-attachment",multiple:false,compact:true,items:[{name:c.Loc.getMessage("LANDING_FIELD_COLOR-BG_FIXED"),value:true}],onChange:this.onAttachmentChange.bind(this)})}buildLayout(){return c.Tag.render(Ct||(Ct=yt`
			<div class="landing-ui-field-color-image">
				${0}
				${0}
				${0}
			</div>
		`),this.imgField.getLayout(),this.sizeField.getLayout(),this.attachmentField.getLayout())}onImageChange(e){const t=this.getValue()||new bt;if(e.getData().value.src){t.setUrl(e.getData().value.src);t.setFileId(e.getData().value.id);if(e.getData().value.src2x){t.setUrl2x(e.getData().value.src2x);t.setFileId2x(e.getData().value.id2x)}}else{t.setUrl(null);t.setFileId(null);t.setUrl2x(null);t.setFileId2x(null)}this.setValue(t);this.onChange();this.saveNode(t)}saveNode(e){const t=this.options.styleNode;const s=this.options.block;let i;if(t.selector===s.selector||t.selector===s.makeAbsoluteSelector(s.selector)){i="#wrapper"}else if(!t.isSelectGroup()){i=BX.Landing.Utils.join(t.selector.split("@")[0],"@",t.getElementIndex(t.getNode()[0]))}else{i=t.selector.split("@")[0]}const a={[i]:{}};a[i].id=e.getFileId()||-1;a[i].id2x=e.getFileId2x()||-1;o.Backend.getInstance().action("Landing\\Block::updateNodes",{block:this.options.block.id,data:a})}onSizeChange(e){if(c.Type.isString(e)){const t=this.getValue()||new bt;t.setSize(e);this.setValue(t);this.onChange()}}onAttachmentChange(e){if(e instanceof r.BaseEvent){const e=this.getValue()||new bt;e.setAttachment(bt.getAttachmentValueByBool(this.attachmentField.getValue()));this.setValue(e);this.onChange()}}onChange(e){this.cache.delete("value");this.emit("onChange",{data:{image:this.getValue()}})}getValue(){return this.cache.remember("value",(()=>{const e=this.imgField.getValue();const t=e.src;if(t===null){return null}else{const s=new bt({url:t,fileId:e.id});if(e.src2x){s.setUrl2x(e.src2x);s.setFileId2x(e.fileId2x)}const i=this.sizeField.getValue();if(i!==null){s.setSize(i)}s.setAttachment(bt.getAttachmentValueByBool(this.attachmentField.getValue()));return s}}))}setValue(e){if(this.isNeedSetValue(e)){super.setValue(e);if(e===null){this.imgField.setValue({src:""},true)}else{if(e.getUrl()!==null){this.setActive()}const t={type:"image",src:e.getUrl(),id:e.getFileId()};if(e.getUrl2x()){t.src2x=e.getUrl2x();t.id2x=e.getFileId2x()}this.imgField.setValue(t,true);this.sizeField.setValue(e.getSize(),true);this.attachmentField.setValue([e.getAttachment(true)])}}}setActive(){c.Dom.addClass(this.imgField.getLayout(),At.ACTIVE_CLASS)}unsetActive(){c.Dom.removeClass(this.imgField.getLayout(),At.ACTIVE_CLASS)}}function Lt(e){const t=/\d{1,3}(\.\d+)?/g;const s=e.match(t);const i=s[0]?s[0]:null;const a=s[1]?s[1]:null;const r=s[2]?s[2]:null;if(i===null||a===null||r===null){return null}return Tt(i,a,r)}function Tt(e,t,s){return"rgb("+e+","+t+","+s+")"}let Et=e=>e,It;class Vt extends pt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.Bg");this.styleNode=e.styleNode;this.parentVariableName=this.variableName;this.variableName=[this.parentVariableName,Vt.BG_URL_VAR,Vt.BG_URL_2X_VAR,Vt.BG_OVERLAY_VAR,Vt.BG_SIZE_VAR,Vt.BG_ATTACHMENT_VAR,Vt.BG_IMAGE];this.parentClassName=this.className;this.className="g-bg-image";this.image=new At(e);this.image.subscribe("onChange",this.onImageChange.bind(this));this.overlay=new xe(e);this.overlay.subscribe("onChange",this.onOverlayColorChange.bind(this));this.overlayOpacity=new Ue({defaultOpacity:.5});this.overlayOpacity.subscribe("onChange",this.onOverlayOpacityChange.bind(this));this.overlayPrimary=new le;this.overlayPrimary.subscribe("onChange",this.onOverlayPrimaryChange.bind(this));const t={};t.textCode="LANDING_FIELD_COLOR_OVERLAY_ZEROING_TITLE_2";this.overlayZeroing=new et(t);this.overlayZeroing.subscribe("onChange",this.overlayZeroingChange.bind(this));this.imageTabs=(new qe).appendTab("Overlay",c.Loc.getMessage("LANDING_FIELD_COLOR-BG_OVERLAY"),[this.overlay,this.overlayPrimary,this.overlayZeroing,this.overlayOpacity]);this.bigTabs=(new qe).setBig(true).appendTab("Color",c.Loc.getMessage("LANDING_FIELD_COLOR-BG_COLOR"),[this.colorSet,this.primary,this.zeroing,this.tabs]).appendTab("Image",c.Loc.getMessage("LANDING_FIELD_COLOR-BG_IMAGE"),[this.image,this.imageTabs])}buildLayout(){return c.Tag.render(It||(It=Et`
			<div class="landing-ui-field-color-color">
				${0}
			</div>
		`),this.bigTabs.getLayout())}onColorSetChange(e){this.image.unsetActive();this.overlay.unsetActive();super.onColorSetChange(e)}onGradientChange(e){this.image.unsetActive();this.overlay.unsetActive();super.onGradientChange(e)}onImageChange(){this.unsetActive();this.activeControl=this.image;this.image.setActive();this.modifyStyleNode(this.styleNode)}onOverlayChange(e){const t=e.getData().color;if(t!==null){t.setOpacity(this.overlayOpacity.getValue().getOpacity())}this.overlayOpacity.setValue(t);const s=this.image.getValue();if(s!==null){this.image.setValue(s.setOverlay(t));this.activeControl=this.image;this.image.setActive();this.colorSet.unsetActive();this.gradient.unsetActive()}this.modifyStyleNode(this.styleNode)}onOverlayOpacityChange(){this.modifyStyleNode(this.styleNode)}onOverlayColorChange(e){this.overlayPrimary.unsetActive();this.overlayZeroing.unsetActive();this.onOverlayChange(e)}onOverlayPrimaryChange(e){this.overlay.unsetActive();this.overlayZeroing.unsetActive();this.onOverlayChange(e)}overlayZeroingChange(e){this.overlay.unsetActive();this.overlayPrimary.unsetActive();this.overlayZeroing.setActive();this.onOverlayChange(e)}unsetActive(){super.unsetActive();this.image.unsetActive()}setProcessorValue(e){this.cache.delete("value");this.setValue(e)}setValue(e){this.image.setValue(null);this.bigTabs.showTab("Color");if(c.Type.isNull(e)){super.setValue(e)}else if(c.Type.isString(e)){super.setValue(e)}else if(this.parentVariableName in e&&c.Type.isString(e[this.parentVariableName])){super.setValue(e[this.parentVariableName])}else if(c.Type.isObject(e)){const t=new bt;if(Vt.BG_URL_VAR in e){t.setUrl(e[Vt.BG_URL_VAR].replace(/url\(["']/i,"").replace(/['"]\)/i,""))}if(Vt.BG_URL_2X_VAR in e){t.setUrl2x(e[Vt.BG_URL_2X_VAR].replace(/url\(["']/i,"").replace(/['"]\)/i,""))}if(Vt.BG_SIZE_VAR in e){t.setSize(e[Vt.BG_SIZE_VAR])}if(Vt.BG_ATTACHMENT_VAR in e){t.setAttachment(e[Vt.BG_ATTACHMENT_VAR])}if(Vt.BG_OVERLAY_VAR in e){t.setOverlay(new R(e[Vt.BG_OVERLAY_VAR]))}this.image.setValue(t);this.bigTabs.showTab("Image");this.activeControl=this.image;this.imageTabs.showTab("Overlay");if(Vt.BG_OVERLAY_VAR in e){const t=new R(e[Vt.BG_OVERLAY_VAR]);this.overlay.setValue(t);this.overlayOpacity.setValue(t);if(e[Vt.BG_OVERLAY_VAR].startsWith("var(--primary")||e["isPrimaryBasedColor"]===true){this.overlayPrimary.setActive();this.overlay.unsetActive()}}else{this.overlayZeroing.setActive()}}}getValue(){return this.cache.remember("value",(()=>{if(this.activeControl===this.image){const e=this.image.getValue();let t;let s=false;if(this.overlay.isActive()){t=this.overlay.getValue();s=true}if(this.overlayPrimary.isActive()){t=this.overlayPrimary.getValue();s=true}if(this.overlayZeroing.isActive()){t=null}if(e!==null&&t!==null&&s){t.setOpacity(this.overlayOpacity.getValue().getOpacity());e.setOverlay(t)}return e}else{return super.getValue()}}))}getClassName(){const e=this.getValue();if(e===null||e instanceof R||e instanceof ve){return[this.parentClassName]}return[this.className]}getStyle(){if(this.getValue()===null){return{[this.parentVariableName]:null,[Vt.BG_URL_VAR]:null,[Vt.BG_URL_2X_VAR]:null,[Vt.BG_OVERLAY_VAR]:null,[Vt.BG_SIZE_VAR]:null,[Vt.BG_ATTACHMENT_VAR]:null}}const e=this.getValue();let t=null;let s=null;let i=null;let a=null;let r=null;let n=null;const o="";if(e instanceof R||e instanceof ve){t=e.getStyleString()}else{s=e.getUrl()?`url('${e.getUrl()}')`:"";i=e.getUrl2x()?`url('${e.getUrl2x()}')`:"";a=e.getOverlay()?e.getOverlay().getStyleString():"rgba(0, 0, 0, 0)";r=e.getSize();n=e.getAttachment()}return{[this.parentVariableName]:t,[Vt.BG_URL_VAR]:s,[Vt.BG_URL_2X_VAR]:i?i:s,[Vt.BG_OVERLAY_VAR]:a,[Vt.BG_SIZE_VAR]:r,[Vt.BG_ATTACHMENT_VAR]:n,[Vt.BG_IMAGE]:o}}modifyStyleNode(e){c.Dom.style(e.getNode()[0],Vt.BG_IMAGE,"");this.onChange()}prepareProcessorValue(e,t){if(t&&t.hasOwnProperty(Vt.BG_IMAGE)){const s=/url\(/i;const i=t[Vt.BG_IMAGE].match(s);if(i!==null){e[Vt.BG_IMAGE]="";e[Vt.BG_SIZE_VAR]=S;e[Vt.BG_ATTACHMENT_VAR]=P;const s=/image-set\(url\(/i;const i=t[Vt.BG_IMAGE].match(s);if(i!==null){const s=/"(https?:\/)?\/[\S]*"/gi;const i=t[Vt.BG_IMAGE].match(s);if(i){e[Vt.BG_URL_VAR]=i[0].replaceAll('"',"");if(i.length===2){e[Vt.BG_URL_2X_VAR]=i[1].replaceAll('"',"")}else{e[Vt.BG_URL_2X_VAR]=i[0].replaceAll('"',"")}}}else{e[Vt.BG_URL_VAR]=t[Vt.BG_IMAGE];e[Vt.BG_URL_2X_VAR]=t[Vt.BG_IMAGE]}const a=getComputedStyle(this.styleNode.getNode()[0],":after");e[Vt.BG_OVERLAY_VAR]=a.backgroundColor;const r=Lt(a.backgroundColor);const n=Lt(a.getPropertyValue("--primary-opacity-0"));if(r!==null&&n!==null&&r===n){e["isPrimaryBasedColor"]=true}}}return e}}Vt.BG_URL_VAR="--bg-url";Vt.BG_URL_2X_VAR="--bg-url-2x";Vt.BG_OVERLAY_VAR="--bg-overlay";Vt.BG_SIZE_VAR="--bg-size";Vt.BG_ATTACHMENT_VAR="--bg-attachment";Vt.BG_IMAGE="background-image";class _t extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BorderColor");this.property="border-color";this.variableName="--border-color";this.className="g-border-color"}}class St extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BorderColorHover");this.property="border-color";this.variableName="--border-color--hover";this.className="g-border-color--hover";this.pseudoClass=":hover"}}class Pt extends pt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BgColorHover");this.property=["background-image","background-color"];this.variableName="--bg-hover";this.className="g-bg--hover";this.pseudoClass=":hover"}}class Nt extends pt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BgColorAfter");this.property=["background-image","background-color"];this.variableName="--bg--after";this.className="g-bg--after";this.pseudoClass=":after";const t=this.getValue()||new R;this.opacity.setValue(t.setOpacity(.5));this.tabs.showTab("Opacity")}}class wt extends pt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BgColorBefore");this.property=["background-image","background-color"];this.variableName="--bg--before";this.className="g-bg--before";this.pseudoClass=":before";const t=this.getValue()||new R;this.opacity.setValue(t.setOpacity(.5));this.tabs.showTab("Opacity")}}class Rt extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarColor");this.property="color";this.variableName="--navbar-color";this.className="u-navbar-color"}}class Ot extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarColorHover");this.property="color";this.variableName="--navbar-color--hover";this.className="u-navbar-color--hover";this.pseudoClass=":hover"}}class Bt extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarColorFixMoment");this.property="color";this.variableName="--navbar-color--fix-moment";this.className="u-navbar-color--fix-moment"}}class kt extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarColorFixMomentHover");this.property="color";this.variableName="--navbar-color--fix-moment--hover";this.className="u-navbar-color--fix-moment--hover";this.pseudoClass=":hover"}}class Dt extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarBgColor");this.property="background-color";this.variableName="--navbar-bg-color";this.className="u-navbar-bg"}}class xt extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarBgColorHover");this.property="background-color";this.variableName="--navbar-bg-color--hover";this.className="u-navbar-bg--hover";this.pseudoClass=":hover"}}class Ft extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BorderColorTop");this.property="border-top-color";this.variableName="--border-color-top";this.className="g-border-color-top"}}class Gt extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.FillColor");this.property="fill";this.pseudoClass=":before";this.variableName="--fill-first";this.className="g-fill-first"}}class Mt extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.FillColorSecond");this.property="fill";this.pseudoClass=":after";this.variableName="--fill-second";this.className="g-fill-second"}}class Ht extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.ButtonColor");this.property="background-color";this.variableName=[Ht.COLOR_CONTRAST_VAR,Ht.COLOR_HOVER_VAR,Ht.COLOR_LIGHT_VAR,Ht.COLOR_VAR];this.className="g-button-color"}getStyle(){if(this.getValue()===null){return{[Ht.COLOR_CONTRAST_VAR]:null,[Ht.COLOR_HOVER_VAR]:null,[Ht.COLOR_LIGHT_VAR]:null,[Ht.COLOR_VAR]:null}}const e=this.getValue();const t=e.getContrast().lighten(10);const s=new R(e).lighten(10);const i=e.getLighten();return{[Ht.COLOR_CONTRAST_VAR]:t.getStyleString(),[Ht.COLOR_HOVER_VAR]:s.getStyleString(),[Ht.COLOR_LIGHT_VAR]:i.getStyleString(),[Ht.COLOR_VAR]:e.getStyleString()}}}Ht.COLOR_CONTRAST_VAR="--button-color-contrast";Ht.COLOR_HOVER_VAR="--button-color-hover";Ht.COLOR_LIGHT_VAR="--button-color-light";Ht.COLOR_VAR="--button-color";class Ut extends it{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarCollapseBgColor");this.property="background-color";this.variableName="--navbar-collapse-bg-color";this.className="u-navbar-collapse-bg"}}class $t extends t.BaseField{constructor(e){super(e);this.items="items"in e&&e.items?e.items:[];this.postfix=typeof e.postfix==="string"?e.postfix:"";this.frame=typeof e.frame==="object"?e.frame:null;const t={block:e.block,styleNode:e.styleNode,selector:e.selector,contentRoot:this.contentRoot};this.changeHandler=typeof e.onChange==="function"?e.onChange:()=>{};this.resetHandler=typeof e.onReset==="function"?e.onReset:function(){};switch(e.subtype){case"color":this.processor=new it(t);break;case"color-hover":this.processor=new at(t);break;case"bg":this.processor=new Vt(t);break;case"bg-color":this.processor=new pt(t);break;case"bg-color-hover":this.processor=new Pt(t);break;case"bg-color-after":this.processor=new Nt(t);break;case"bg-color-before":this.processor=new wt(t);break;case"border-color":this.processor=new _t(t);break;case"border-color-hover":this.processor=new St(t);break;case"border-color-top":this.processor=new Ft(t);break;case"navbar-color":this.processor=new Rt(t);break;case"navbar-color-hover":this.processor=new Ot(t);break;case"navbar-color-fix-moment":this.processor=new Bt(t);break;case"navbar-color-fix-moment-hover":this.processor=new kt(t);break;case"navbar-bg-color":this.processor=new Dt(t);break;case"navbar-bg-color-hover":this.processor=new xt(t);break;case"navbar-collapse-bg-color":this.processor=new Ut(t);break;case"fill-color":this.processor=new Gt(t);break;case"fill-color-second":this.processor=new Mt(t);break;case"button-color":this.processor=new Ht(t);break;default:break}this.property=this.processor.getProperty()[this.processor.getProperty().length-1];this.processor.getClassName().forEach((e=>this.items.push({name:e,value:e})));c.Dom.remove(this.input);this.layout.classList.add("landing-ui-field-color");c.Dom.append(this.processor.getLayout(),this.layout);this.processor.subscribe("onChange",this.onChange.bind(this));this.processor.subscribe("onReset",this.onReset.bind(this))}getInlineProperties(){return this.processor.getVariableName()}prepareInlineProperties(e){e.push("background-image");return e}getComputedProperties(){return this.processor.getProperty()}getPseudoElement(){return this.processor.getPseudoClass()}onChange(){this.changeHandler({className:this.processor.getClassName(),style:this.processor.getStyle()},this.items,this.postfix,this.property);this.emit("onChange")}onReset(){this.resetHandler(this.items,this.postfix,this.property)}getValue(){return this.processor.getValue()||this.processor.getNullValue()}setValue(e){let t=null;this.prepareInlineProperties(this.getInlineProperties()).forEach((s=>{if(s in e&&!this.processor.isNullValue(e[s])){if(!c.Type.isObject(t)){t={}}t[s]=e[s]}}));let s=null;this.getComputedProperties().forEach((t=>{if(t in e&&!this.processor.isNullValue(e[t])){if(!c.Type.isObject(s)){s={}}s[t]=e[t]}}));t=this.processor.prepareProcessorValue(t,s);if(t!==null){this.processor.setProcessorValue(t)}else{this.processor.setDefaultValue(s);this.processor.defineActiveControl(this.items,this.data.styleNode)}}onFrameLoad(){const e=this.data.styleNode.getValue(true);this.setValue(e.style)}}e.ColorField=$t})(this.BX.Landing.UI.Field=this.BX.Landing.UI.Field||{},BX.Landing.UI.Field,BX.Main,BX,BX,BX.Event,BX.Landing.UI.Field,BX.Landing,BX.Landing,BX);
//# sourceMappingURL=color_field.bundle.map.js